package com.leyou.upload.config;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import com.leyou.upload.properties.OSSProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author by my
 * @Description TODO 阿里云oss配置类
 * @Date 2020/4/1 10:12
 */
@Configuration
public class OSSConfig {

    /**
     * 生成签名
     *
     * @param properties
     * @return
     */
    @Bean
    public OSS client(OSSProperties properties) {
        return new OSSClientBuilder().build(properties.getEndpoint(),
                properties.getAccessKeyId(), properties.getAccessKeySecret());
    }
}
